<!--楼层号标签-->
<script setup>
import ClickCopy from "@/components/common/click-copy.vue";
import {toRefs} from "vue";

const props = defineProps({
  data: {type: Object},
})

const {data} = toRefs(props)

</script>

<template>
  <span>
    <el-tooltip effect="light">
      <el-tag>#{{ data.floorNumber }}</el-tag>
      <template #content>
        <!--主楼-->
        <el-link v-if="data.replyId===0" :href="'https://bbs.nga.cn/read.php?tid='+data.topicId" target="_blank" type="primary">官方地址</el-link>
        <!--回复-->
        <el-link v-else :href="`https://bbs.nga.cn/read.php?pid=${data.replyId}&to`" target="_blank" type="primary">官方地址</el-link>
        <div>
          <el-divider content-position="left">复制</el-divider>
          <div>
            <click-copy v-if="data.replyId" :text="data.replyId">
              <el-link size="small" type="primary">PID</el-link>
              &nbsp;
            </click-copy>
            <click-copy v-if="data.floorNumber" :text="data.floorNumber">
              <el-link size="small" type="primary">楼层号</el-link>
              &nbsp;
            </click-copy>
            <click-copy v-if="data.replyId" :text="`[pid=${data.replyId}]这个回复[/pid]`">
              <el-link size="small" type="primary">bbsCode</el-link>
              &nbsp;
            </click-copy>
            <click-copy v-else :text="`[tid=${data.topicId}]${data.title?data.title.replace(/\[.+?]/g, ''):'这个帖子'}[/tid]`">
              <el-link size="small" type="primary">bbsCode</el-link>
            </click-copy>
          </div>

        </div>
      </template>
    </el-tooltip>
  </span>
</template>

<style scoped>

</style>